package com.xayy.ha.gen.lite.runner;

import com.xayy.ha.gen.lite.util.GeneratorUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.ExitCodeGenerator;
import org.springframework.stereotype.Component;

@Component
public class GenerateRunner implements ApplicationRunner {
    @Autowired
    GeneratorUtil generatorUtil;
    @Autowired
    ExitCodeGenerator exitCodeGenerator;
    @Override
    public void run(ApplicationArguments args) throws Exception {
        generatorUtil.create();
        System.exit(exitCodeGenerator.getExitCode());
    }
}
